import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

export default new Router({
    routes: [
        {
            path: '/',
            redirect: '/login'
        },
        {
            path: '/',
            component: resolve => require(['../components/common/Home.vue'], resolve),
            meta: { title: '自述文件' },
            children:[
                {
                    path: '/dashboard',
                    component: resolve => require(['../components/page/Dashboard.vue'], resolve),
                    meta: { title: '系统首页' }
                },
                {
                    path: '/icon',
                    component: resolve => require(['../components/page/Icon.vue'], resolve),
                    meta: { title: '自定义图标' }
                },
                {
                    path: '/table',
                    component: resolve => require(['../components/page/BaseTable.vue'], resolve),
                    meta: { title: '基础表格' }
                },
                {
                    path: '/tabs',
                    component: resolve => require(['../components/page/Tabs.vue'], resolve),
                    meta: { title: 'tab选项卡' }
                },
                {
                    path: '/form',
                    component: resolve => require(['../components/page/BaseForm.vue'], resolve),
                    meta: { title: '基本表单' }
                },
                {
                    // 富文本编辑器组件
                    path: '/editor',
                    component: resolve => require(['../components/page/VueEditor.vue'], resolve),
                    meta: { title: '富文本编辑器' }
                },
                {
                    // markdown组件
                    path: '/markdown',
                    component: resolve => require(['../components/page/Markdown.vue'], resolve),
                    meta: { title: 'markdown编辑器' }    
                },
                {
                    // 图片上传组件
                    path: '/upload',
                    component: resolve => require(['../components/page/Upload.vue'], resolve),
                    meta: { title: '文件上传' }   
                },
                {
                    // vue-schart组件
                    path: '/charts',
                    component: resolve => require(['../components/page/BaseCharts.vue'], resolve),
                    meta: { title: 'schart图表' }
                },
                {
                    // 拖拽列表组件
                    path: '/drag',
                    component: resolve => require(['../components/page/DragList.vue'], resolve),
                    meta: { title: '拖拽列表' }
                },
                {
                    // 拖拽Dialog组件
                    path: '/dialog',
                    component: resolve => require(['../components/page/DragDialog.vue'], resolve),
                    meta: { title: '拖拽弹框' }
                },
                {
                    // 权限页面
                    path: '/permission',
                    component: resolve => require(['../components/page/Permission.vue'], resolve),
                    meta: { title: '权限测试', permission: true }
                },
                {
                    path: '/404',
                    component: resolve => require(['../components/page/404.vue'], resolve),
                    meta: { title: '404' }
                },
                {
                    path: '/403',
                    component: resolve => require(['../components/page/403.vue'], resolve),
                    meta: { title: '403' }
                },
                {
                    // RemainChain
                    path: '/remainChain',
                    component: resolve => require(['../components/page/manager/RemainChain.vue'], resolve),
                    meta: { title: '已有链码', permission: true }
                },
                {
                    // 部署链码
                    path: '/setChain',
                    component: resolve => require(['../components/page/manager/SetChain.vue'], resolve),
                    meta: { title: '部署链码', permission: true }
                },
                {
                    // 账本查询
                    path: '/serchAccount',
                    component: resolve => require(['../components/page/manager/SerchAccount.vue'], resolve),
                    meta: { title: '账本查询', permission: true }
                },
                {
                    // 已有公告
                    path: '/announcement',
                    component: resolve => require(['../components/page/manager/Announcement.vue'], resolve),
                    meta: { title: '已有公告', permission: true }
                },
                {
                    // 发行积分
                    path: '/releasePoint',
                    component: resolve => require(['../components/page/manager/ReleasePoint.vue'], resolve),
                    meta: { title: '发行积分', permission: true }
                },
                {
                    // 发布新公告
                    path: '/reAnnouncement',
                    component: resolve => require(['../components/page/manager/ReAnnouncement.vue'], resolve),
                    meta: { title: '发布新公告', permission: true }
                },
                // 消费者
                {
                    // 消息中心
                    path: '/messageCenter',
                    component: resolve => require(['../components/page/user/MessageCenter.vue'], resolve),
                    meta: { title: '消息中心', permission: true }
                },
                {
                    // 积分兑换
                    path: '/pointChange',
                    component: resolve => require(['../components/page/user/PointChange.vue'], resolve),
                    meta: { title: '积分兑换', permission: true }
                },
                {
                    // 积分查询
                    path: '/pointInquire',
                    component: resolve => require(['../components/page/user/PointInquire.vue'], resolve),
                    meta: { title: '积分查询', permission: true }
                },
                {
                    // 积分转让
                    path: '/pointTransfer',
                    component: resolve => require(['../components/page/user/PointTransfer.vue'], resolve),
                    meta: { title: '积分转让', permission: true }
                },
                {
                    // 修改个人信息
                    path: '/revisePersonalInfo',
                    component: resolve => require(['../components/page/user/RevisePersonalInfo.vue'], resolve),
                    meta: { title: '修改个人信息', permission: true }
                },
                // 商家
                {
                    // 新建规则
                    path: '/newRule',
                    component: resolve => require(['../components/page/business/NewRule.vue'], resolve),
                    meta: { title: '积分查询', permission: true }
                },
                {
                    // 积分商城
                    path: '/pointMall',
                    component: resolve => require(['../components/page/business/PointMall.vue'], resolve),
                    meta: { title: '积分转让', permission: true }
                },
                {
                    // 交易查询
                    path: '/dealInquiry',
                    component: resolve => require(['../components/page/business/DealInquiry.vue'], resolve),
                    meta: { title: '修改个人信息', permission: true }
                }

            ]
        },
        {
            path: '/login',
            component: resolve => require(['../components/page/Login.vue'], resolve)
        },
        {
            path: '*',
            redirect: '/404'
        },
        {
            path: '/register',
            component: resolve => require(['../components/page/Register.vue'], resolve)
        }
       
    ]
})
